---
title: "f3"
author: "Pierre Barry"
date: "`r format(Sys.time(), '%d %B, %Y, %H:%M')`"
output:
flexdashboard::flex_dashboard:
theme: paper
orientation: rows
social: menu
source_code: embed
vertical_layout: scroll
---
```{r global, include=FALSE}
list.of.packages <- c("RColorBrewer","reshape2","kableExtra","ggplot2","plotly")
for (i in list.of.packages){
if (i %in% installed.packages()[,"Package"] == FALSE){
install.packages(i)
}
eval(bquote(library(.(i))))
}
```
```{r, include = FALSE}
color_med_atl=data.frame(Location=c("Gulf of Lion","Costa Calida","Algarve","Bay of Biscay"),
Col=brewer.pal(n = 4, name = "RdBu"))
```
```{r, include = FALSE}
data = read.table(paste(path,"/output/pop_genomics/f3.csv",sep=""),header = TRUE, sep=",",dec=".")
data = data [,-1]
vcf_f3=cbind(data[,seq(2,ncol(data),by=3)])
vcf_f3=cbind(data[,1],vcf_f3)
colnames(vcf_f3)[1]="Species"
vcf_f3=melt(vcf_f3,id="Species")
vcf_f3_se=cbind(data[,seq(3,ncol(data),by=3)])
vcf_f3_se=cbind(data[,1],vcf_f3_se)
colnames(vcf_f3_se)[1]="Species"
vcf_f3_se=melt(vcf_f3_se,id="Species")
vcf_f3_z=cbind(data[,seq(4,ncol(data),by=3)])
vcf_f3_z=cbind(data[,1],vcf_f3_z)
colnames(vcf_f3_z)[1]="Species"
vcf_f3_z=melt(vcf_f3_z,id="Species")
vcf_f3=cbind(vcf_f3,vcf_f3_se$value,vcf_f3_z$value)
colnames(vcf_f3)[4]="se"
colnames(vcf_f3)[5]="z"
```
Atherina boyeri {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Atherina boyeri**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Aboye" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Aboye" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Aboye" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Aboye" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Alosa fallax {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Alosa fallax**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Afall" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Afall" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (is.na(vcf_f3_sp$value[i]) == F){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Afall" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Afall" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (is.na(vcf_f3_sp$value[i]) == F){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Coryphoblennius galerita {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Coryphoblennius galerita**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cgale" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cgale" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cgale" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cgale" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Coris julis {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Coris julis**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cjuli" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cjuli" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cjuli" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Cjuli" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Dicentrarchus labrax {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Dicentrarchus labrax**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dlabr" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dlabr" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dlabr" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dlabr" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Diplodus puntazzo {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Diplodus puntazzo**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dpunt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dpunt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dpunt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Dpunt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Gobius niger {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Gobius niger**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Gnige" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Gnige" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Gnige" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Gnige" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Hippocampus guttulatus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Hippocampus guttulatus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Hgutt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Hgutt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Hgutt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Hgutt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Lophius budegassa {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Lophius budegassa**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lbude" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lbude" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lbude" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lbude" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Lithognathus mormyrus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Lithognathus mormyrus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lmorm" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lmorm" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lmorm" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Lmorm" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Merluccius merluccius {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Merluccius merluccius**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Mmerl" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Mmerl" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Mmerl" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Mmerl" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Mullus surmuletus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Mullus surmuletus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Msurm" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Msurm" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Msurm" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Msurm" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Pagellus erythrinus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pagellus erythrinus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Peryt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Peryt" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Peryt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Peryt" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Serranus cabrilla {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Serranus cabrilla**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scabr" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scabr" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scabr" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scabr" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Spondyliosoma cantharus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Spondyliosoma cantharus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scant" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scant" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scant" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scant" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Symphodus cinereus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Symphodus cinereus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scine" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scine" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scine" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Scine" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Sardina pilchardus {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Sardina pilchardus**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Spilc" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Spilc" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Spilc" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Spilc" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Sarda sarda {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Sarda sarda**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Ssard" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Ssard" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Ssard" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Ssard" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Syngnathus typhle {data-navmenu="Species"}
=======================================================================
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Syngnathus typhle**</font>
</center>
Row {.tabset data-height=2500}
-----------------------
### Filtered
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Styph" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Filtered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Styph" & !grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
### Unfiltered
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Styph" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop_admix=as.character(vcf_f3_sp$pop_admix)
vcf_f3_sp$pop_1=as.character(vcf_f3_sp$pop_1)
vcf_f3_sp$pop_2=as.character(vcf_f3_sp$pop_2)
vcf_f3_sp[1:3,1]<-cell_spec(vcf_f3_sp[1:3,1], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[4:6,1]<-cell_spec(vcf_f3_sp[4:6,1], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[7:9,1]<-cell_spec(vcf_f3_sp[7:9,1], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[10:12,1]<-cell_spec(vcf_f3_sp[10:12,1], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Gulf of Lion"),2], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Costa Calida"),2], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Algarve"),2], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_1=="Bay of Biscay"),2], color = color_med_atl$Col[4], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Gulf of Lion"),3], color = color_med_atl$Col[1], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Costa Calida"),3], color = color_med_atl$Col[2], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Algarve"),3], color = color_med_atl$Col[3], bold = F)
vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3]<-cell_spec(vcf_f3_sp[which(vcf_f3_sp$pop_2=="Bay of Biscay"),3], color = color_med_atl$Col[4], bold = F)
kbl(vcf_f3_sp,col.names = c("Admixed population",
"Pop.1",
"Pop.2",
"f3",
"se",
"Z")
,escape = F,align=c(rep('c',times=6))) %>%
kable_classic ("striped","hover", full_width = T,html_font = "Cambria") %>%
row_spec(which(vcf_f3_sp$value<0 & vcf_f3_sp$Z<(-3)), bold = T, color = "black")
```
```{r}
# Unfiltered
vcf_f3_sp=vcf_f3[vcf_f3$Species=="Styph" & grepl("UNFILTERED",vcf_f3$variable),]
vcf_f3_sp$pop_admix=substr(vcf_f3_sp$variable,4,5)
vcf_f3_sp$pop_1=substr(vcf_f3_sp$variable,7,8)
vcf_f3_sp$pop_2=substr(vcf_f3_sp$variable,10,11)
vcf_f3_sp=data.frame(pop_admix=vcf_f3_sp$pop_admix,
pop_1=vcf_f3_sp$pop_1,
pop_2=vcf_f3_sp$pop_2,
value=vcf_f3_sp$value,
se=vcf_f3_sp$se,
Z=vcf_f3_sp$z
)
vcf_f3_sp$pop_admix=factor(vcf_f3_sp$pop_admix,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_1=factor(vcf_f3_sp$pop_1,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$pop_2=factor(vcf_f3_sp$pop_2,levels=c("LI","MU","FA","GA")
,labels=c("Gulf of Lion",
"Costa Calida",
"Algarve",
"Bay of Biscay"))
vcf_f3_sp$value=round(vcf_f3_sp$value,5)
vcf_f3_sp$se=round(vcf_f3_sp$se,5)
vcf_f3_sp$Z=round(vcf_f3_sp$Z,5)
vcf_f3_sp$pop1_pop2=paste(vcf_f3_sp$pop_admix,";",vcf_f3_sp$pop_1,"-",vcf_f3_sp$pop_2,sep="")
vcf_f3_sp$pop1_pop2=factor(vcf_f3_sp$pop1_pop2,
levels=c(vcf_f3_sp$pop1_pop2))
def=c()
for (i in 1:nrow(vcf_f3_sp)){
if (vcf_f3_sp$value[i]<0 & vcf_f3_sp$Z[i]<(-3)){
def[i]="Negative"
} else {
def[i]="Zero"
}
}
vcf_f3_sp$def=def
p<-ggplot(vcf_f3_sp,aes(x=pop1_pop2,y=value,fill=pop_admix))+
geom_bar(stat="identity", aes(color=def))+
geom_errorbar(aes(ymin=value-se, ymax=value+se),width=.2,
position=position_dodge(.9)) +
theme_bw() +
scale_fill_manual(values=color_med_atl$Col)+
scale_color_manual(breaks=c("Negative","Zero"),values=c("chartreuse4","white"))+
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=45)
) +
scale_x_discrete(labels=c("Gulf of Lion;Costa Calida-Algarve" = "Costa Calida-Algarve",
"Gulf of Lion;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Gulf of Lion;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Costa Calida;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Costa Calida;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Costa Calida;Algarve-Bay of Biscay" = "Algarve-Bay of Biscay",
"Algarve;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Algarve;Gulf of Lion-Bay of Biscay" = "Gulf of Lion-Bay of Biscay",
"Algarve;Costa Calida-Bay of Biscay" = "Costa Calida-Bay of Biscay",
"Bay of Biscay;Gulf of Lion-Costa Calida" = "Gulf of Lion-Costa Calida",
"Bay of Biscay;Gulf of Lion-Algarve" = "Gulf of Lion-Algarve",
"Bay of Biscay;Costa Calida-Algarve" = "Costa Calida-Algarve"))+
xlab("Pop1,Pop2")+
ylab("f3")
p<-ggplotly(p,height=500) %>% partial_bundle()
p
```
Packages used {data-icon="fa-map"}
=======================================================================
```{r}
installed.packages()[names(sessionInfo()$otherPkgs), "Version"]
```